import os
try:
    import xml.etree.cElementTree as ET
except ImportError:
    import xml.etree.ElementTree as ET
import sys
path = './det_dataset_0901/train/box/G0024172(video5)'
# i = 0
for file in os.listdir(path):
    if os.path.isfile(os.path.join(path,file)) == True:
        name = file.split('.')
        if name[1] != 'jpg' and name[1] != 'xml':
            name[1] = 'jpg'
        name[0] = 'Video5_' + name[0]
        # i = i+1
        newname = name[0] + '.'+ name[1]
        os.rename(os.path.join(path, file), os.path.join(path,newname))
        print(file, 'rename ok')
